package com.tutorialspoint.test.view;

import java.io.Serializable;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;

import com.tutorialspoint.test.model.Car;
import com.tutorialspoint.test.service.CarService;

@ManagedBean(name="dtBasicView")
@ViewScoped
public class BasicView implements Serializable {
     
	private static final long serialVersionUID = 1L;

	private List<Car> cars;
	private boolean renderColorColumn;
     
    public boolean isRenderColorColumn() {
		return renderColorColumn;
	}

	public void setRenderColorColumn(boolean renderColorColumn) {
		this.renderColorColumn = renderColorColumn;
	}

	@ManagedProperty("#{carService}")
    private CarService service;
 
    @PostConstruct
    public void init() {
        cars = service.createCars(10);
    }
     
    public List<Car> getCars() {
        return cars;
    }
 
    public void setService(CarService service) {
        this.service = service;
    }
}